<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core">
    <ui:composition template="templateadmin.xhtml">
        <ui:define name="content">
            <script type="text/javascript">
                    function show_alert()
                    {
                        alert("Car Model has been changed!");
                    }function show_alert2()
                    {
                        alert("create new model complete!");
                    }

                    function show_confirm(){
                        var r=confirm("Are your sure update information!");
                        if (r==true)
                          {
                          alert("information has been changed");
                          }
                        else
                          {
                          alert(" stoped change!");
                          }
                    }
            </script>
            <center>
                <h1>Car Model Management</h1>
                <br/>
                <h:form id="form1">
                    <center>
                        <table border="0" cellpadding="0" cellspacing="0" id="product-table">
                            <tr>
                                <th class="table-header-repeat line-left minwidth-1" width="30px"><a href="">Model ID</a>	</th>
                                <th class="table-header-repeat line-left minwidth-1" width="220px"><a href="">Model Name</a></th>
                                <th class="table-header-repeat line-left minwidth-1" width="220px"><a href="">Description</a></th>
                                <th class="table-header-repeat line-left minwidth-1" width="100px"><a href="">Option</a></th>
                            </tr>
                            <ui:repeat value="#{modelBean.lmodel}" var="lmodel">
                                <tr>
                                    <td>#{lmodel.modelID}</td>

                                    <td><h:inputText id="txtModel" value="#{lmodel.modelName}" requiredMessage="please model name" required="true" styleClass="inp-form"></h:inputText></td>
                                    <h:message for="txtModel"></h:message>
                                    <td><h:inputTextarea value="#{lmodel.description}" id="txtdes" requiredMessage="please description model" required="true" styleClass="form-textarea2" style="width: 300px"></h:inputTextarea></td>
                                    <h:message for="txtdes"></h:message>
                                    <td><h:commandButton action="#{modelBean.actionUpdateModel(lmodel)}"  styleClass="form-update" onclick="show_confirm()"></h:commandButton></td>
                                </tr>
                            </ui:repeat>
                        </table>
                    </center>
                </h:form>
                <h:form id ="form2">
                    <center>
                        <table border="0" cellpadding="0" cellspacing="0" id="product-table" style="margin: 0 0 0 112px; ">
                            <tr>
                                <th class="table-header-repeat line-left minwidth-1" width="220px"><a href="">Model Name</a></th>
                                <th class="table-header-repeat line-left minwidth-1" width="220px"><a href="">Description</a></th>
                                <th class="table-header-repeat line-left minwidth-1" width="100px"><a href="">Option</a></th>

                            </tr>
                            <tr>

                                <td> <h:inputText value="#{modelBean.model.modelName}" id="txtModelName" styleClass="inp-form" required="true" requiredMessage="please input model name"></h:inputText>
                                    <br/>
                                    <h:message for="txtModelName"></h:message>
                                </td>
                                <td><h:inputTextarea value="#{modelBean.model.description}" styleClass="form-textarea2" id="txtdescrip" required="true" requiredMessage="please input model description"></h:inputTextarea></td>
                                <br/>
                                <h:message for="txtdescrip"></h:message>
                                <td>
                                    <h:commandButton action="#{modelBean.actionCreateModel}" styleClass="form-submit"></h:commandButton>
                                </td>
                            </tr>
                        </table>
                    </center>
                </h:form>
            </center>
        </ui:define>
    </ui:composition>
</html>


